package view;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JTextField;

/**
 * @author REMY Timothée and CARTIER Arthur
 * 
 */
public class Keylisten implements KeyListener {

	private final JTextField jtf;
	private final String[] results;
	private final int index;

	public Keylisten(final JTextField jtf, final String[] results,
			final int index) {
		super();
		this.jtf = jtf;
		this.results = results;
		this.index = index;
	}

	/**
	 * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent)
	 * @param e
	 */
	@Override
	public void keyPressed(final KeyEvent e) {
	}

	/**
	 * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
	 * @param e
	 */
	@Override
	public void keyReleased(final KeyEvent e) {
		results[index] = jtf.getText();
	}

	/**
	 * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent)
	 * @param e
	 */
	@Override
	public void keyTyped(final KeyEvent e) {
		// TODO Auto-generated method stub

	}

}
